package com.csxy.lsh;

import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;

import java.io.IOException;

public class ResponseUtil {
    public static void out(HttpServletResponse response, R r){
        ObjectMapper mapper = new ObjectMapper();
        response.setStatus(HttpStatus.OK.value());
        response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
        try{
            mapper.writeValue(response.getWriter(),r);



        } catch (IOException e){
            e.printStackTrace();
        }

    }
}
